package dwz.business.lotto.impl;

import java.util.List;

import dwz.business.lotto.HuiYuanSheZhiInterface;
import dwz.common.util.web.PageInfo;
import dwz.persistence.beans.HuiYuanSheZhi;
import dwz.persistence.beans.HuiYuanSheZhiExample;
import dwz.persistence.mapper.HuiYuanSheZhiMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional(rollbackFor = Exception.class)
@Service
public class HuiYuanSheZhiInterfaceImpl implements HuiYuanSheZhiInterface{
	@Autowired
	HuiYuanSheZhiMapper huiYuanSheZhiMapper;
	@Override
	public int countByExample(HuiYuanSheZhiExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteByExample(HuiYuanSheZhiExample example) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(HuiYuanSheZhi record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<HuiYuanSheZhi> selectByExample(HuiYuanSheZhiExample example) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<HuiYuanSheZhi> selectByExampleWithPage(
			HuiYuanSheZhiExample example, PageInfo pageInfo) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public HuiYuanSheZhi selectByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(HuiYuanSheZhi entity) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<HuiYuanSheZhi> selectAllWithPage(HuiYuanSheZhi entity,
			PageInfo pageInfo) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public HuiYuanSheZhi selectEntityByExample(HuiYuanSheZhiExample example) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateUserProfile(String[] huishuiStrings,
			String[] peilvStrings, Integer id) throws Exception {
		HuiYuanSheZhi huiYuanSheZhi = null;
		
		int type = 11;
		for(int k = 0 ; k < huishuiStrings.length ; k++){
			
			if(k == 0){
				for(int i = 1; i < 7 ; i++){
					huiYuanSheZhi = new HuiYuanSheZhi();
					HuiYuanSheZhiExample huiYuanSheZhiExample = new HuiYuanSheZhiExample();
					huiYuanSheZhiExample.createCriteria().andYh_id_jEqualTo(id).andLx_jEqualTo(i);
					huiYuanSheZhi.setZjhs_j(Float.parseFloat(huishuiStrings[k]));
					huiYuanSheZhi.setZjpl_j(Float.parseFloat(peilvStrings[k]));
					
					huiYuanSheZhiMapper.updateByExampleSelective(huiYuanSheZhi, huiYuanSheZhiExample);
					
				}
				
			}else if(k == 1){
				for(int i = 7; i < 11 ; i++){
					huiYuanSheZhi = new HuiYuanSheZhi();
					HuiYuanSheZhiExample huiYuanSheZhiExample = new HuiYuanSheZhiExample();
					huiYuanSheZhiExample.createCriteria().andYh_id_jEqualTo(id).andLx_jEqualTo(i);
					huiYuanSheZhi.setZjhs_j(Float.parseFloat(huishuiStrings[k]));
					huiYuanSheZhi.setZjpl_j(Float.parseFloat(peilvStrings[k]));
					huiYuanSheZhiMapper.updateByExampleSelective(huiYuanSheZhi, huiYuanSheZhiExample);
				}
			}else{
				huiYuanSheZhi = new HuiYuanSheZhi();
				HuiYuanSheZhiExample huiYuanSheZhiExample = new HuiYuanSheZhiExample();
				huiYuanSheZhiExample.createCriteria().andYh_id_jEqualTo(id).andLx_jEqualTo(type++);
				huiYuanSheZhi.setZjhs_j(Float.parseFloat(huishuiStrings[k]));
				huiYuanSheZhi.setZjpl_j(Float.parseFloat(peilvStrings[k]));
				System.out.println(type+"---------------");
				huiYuanSheZhiMapper.updateByExampleSelective(huiYuanSheZhi, huiYuanSheZhiExample);
				
				
			}
			
		}
		
	
		
	}

}
